package com.ruoyi.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.FileObject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.typehandler.FileObjectTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;

import java.util.List;

/**
 * 驾驶员信息对象 t_driver_info
 * 
 * @author wp
 * @date 2023-08-10
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
@Accessors(chain = true)
@TableName(value = "t_driver_info", excludeProperty = "remark")
public class DriverInfo extends BaseEntity {

    /** 驾驶员id */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /** 所属作业公司 */
    @ApiModelProperty("公司ID")
    private Long companyId;

    /** 姓名 */
    @Excel(name = "负责人姓名", sort = 1)
    @ApiModelProperty("姓名")
    private String name;

    /** 联系电话 */
    @Excel(name = "联系电话", sort = 5)
    private String contactNumber;

    /** 身份证 */
    @Excel(name = "身份证号", width = 30, sort = 4)
    private String idCard;

    /** 性别  0:未知 1：男 2：女 */
    private Integer sex;

    /** 驾驶证类型 */
    private String licenseType;

    /** 驾驶证号 */
    private String licenseNum;

    /** 驾龄 */
    private Long driverAge;

    /** 图片 */
    @TableField(typeHandler = FileObjectTypeHandler.class)
    private List<FileObject> picture;

    /** 年龄 */
    @Excel(name = "年龄", sort = 6)
    private Integer age;

    @ApiModelProperty("车牌号")
    @Excel(name = "绑定监管对象", width = 30, sort = 3)
    @TableField(exist = false)
    private String numberPlate;
    @Excel(name = "所属公司", width = 30, sort = 2)
    @TableField(exist = false)
    private String companyName;

    @ApiModelProperty("绑定状态")
    @TableField(exist = false)
    private Integer bindStatus;

    @ApiModelProperty("监管对象id")
    @TableField(exist = false)
    private Long vehicleId;

    @ApiModelProperty("ids")
    @TableField(exist = false)
    private List<Long> ids;

    /** 司机状态0空闲1任务中 */
    private Integer driverTaskStatus;

    public Integer getBindStatus() {
        return StringUtils.isEmpty(numberPlate) ? 0 : 1;
    }
}
